import { api } from '@/utils/request'
import type {
  RelationshipStat,
  CreateRelationshipStatRequest,
  UpdateRelationshipStatRequest,
} from '@/types/relationship'

/**
 * 获取所有恋爱统计
 */
export const getRelationshipStats = () => {
  return api.get<RelationshipStat[]>('/relationship-stats')
}

/**
 * 获取单个恋爱统计
 */
export const getRelationshipStat = (id: number) => {
  return api.get<RelationshipStat>(`/relationship-stats/${id}`)
}

/**
 * 创建恋爱统计
 */
export const createRelationshipStat = (data: CreateRelationshipStatRequest) => {
  return api.post<RelationshipStat>('/relationship-stats', data)
}

/**
 * 更新恋爱统计
 */
export const updateRelationshipStat = (id: number, data: UpdateRelationshipStatRequest) => {
  return api.put<RelationshipStat>(`/relationship-stats/${id}`, data)
}

/**
 * 删除恋爱统计
 */
export const deleteRelationshipStat = (id: number) => {
  return api.delete(`/relationship-stats/${id}`)
}
